<?php
		global $_W,$_GPC;

    include   dirname(__FILE__).'/redis.php';
		
		
    $redis=RedisManager::getRedisConn();  

		
		$starttime=time();
		$endtime=time();

		if ($_POST["submit"]) {
			# code...
			$force = $_GPC['force'];
       		 $file = $_FILES['force'];

       		 // var_dump($file);die;

            $type = @end( explode('.', $file['name']));
            $type = strtolower($type); 
            if( !in_array($type, array('xls','xlsx')) ){
                message('文件类型错误！',  '', 'error');
            }


            

            set_time_limit(0);
            include_once IA_ROOT . '/framework/library/phpexcel/PHPExcel.php';
            /** PHPExcel_IOFactory */
            include_once IA_ROOT . '/framework/library/phpexcel/PHPExcel/IOFactory.php';
            if( $type == 'xls' ){
                $inputFileType = 'Excel5';    //这个是读 xls的
            }else{
                $inputFileType = 'Excel2007';//这个是计xlsx的
            }

             $objReader = PHPExcel_IOFactory::createReader($inputFileType);
            $objPHPExcel = $objReader->load($file['tmp_name']);

			 //转换成1970年以来的秒数

            $objWorksheet = $objPHPExcel->getActiveSheet();//取得总行数
            $highestRow = $objWorksheet->getHighestRow();//取得总列数
            for ($row = 2;$row <= $highestRow;$row++){
               $uid = $objWorksheet->getCellByColumnAndRow(0, $row)->getValue();
                $redis->LPUSH('mem',$uid);	
       			             	
            }

       		 	 message('发送成功',  $this->createWebUrl('index'));

		}


		include  $this->template("index");